const net=require('net');

let server=net.createServer(connection=>{
    console.log('client connected');
    connection.on('end',()=>console.log('connection closed.'));
    connection.write('Hello World\n');
    connection.pipe(connection);
});
server.listen(8080,()=>console.log(`Server running at ${JSON.stringify(server.address())}`));
